<template>
	<view style="position: relative;">
		<view class="mask" v-if="showAddress">
			<view class="bg" @click.stop="closeAddress"></view>
			<view class="address">
				<view class="top">选择收获地址</view>
				<view class="center">
					<block v-for="(item,index) in addressGetList">
						<view class="addressLi" @click="selectAddress(index)">
							<view class="radio">
								<image src="/static/order/radio.png" mode="widthFix"></image>
							</view>
							<view class="user">
								<view>{{item.addressName}}{{item.area}}</view>
								<view class="info">
									<view style="margin-right: 20rpx;">{{item.username}}</view>
									<view>{{item.mobile}}</view>
								</view>
							</view>
							<view class="edit" @click="toResetAddress(item.id)">
								<image src="/static/order/edit.png" mode="widthFix"></image>
							</view>
						</view>
						<view class="line"></view>
					</block>
				</view>
				<view class="btn">
					<view class="addbtn" @click="toAddressManagePage">新增收获地址</view>
				</view>
				<view class="close" @click="closeAddress">
					<u-icon name="close"></u-icon>
				</view>
			</view>
		</view>
		<!-- <hx-navbar 
		:border="false" 
		:centerSlidiSwitch="true" 
		:rightSlidiSwitch="false" 
		:fixed="true"
		:pageScroll.sync="scrollData"
		transparent="hidden">
			<view style="text-align: center;width: 100%;"><text style="font-weight: 700;font-size: 32rpx;">提交订单</text></view>
			<view slot="centerAfter" style="text-align: center;width: 100%;"><text>选择收货地址 ></text></view>
		</hx-navbar> -->
		<hx-navbar :back="true" :fixed="true" :border="false" :background-color="[219,249,241]" height="140rpx"
			barPlaceholder="hidden" :centerSlidiSwitch="true" :rightSlidiSwitch="false" :pageScroll.sync="scrollData">
			<view style="text-align: center;width: 100%;"><text style="font-weight: 700;font-size: 32rpx;">提交订单</text>
			</view>
			<view slot="centerAfter" style="text-align: center;width: 100%;"><text
					style="font-weight: 700;font-size: 32rpx;">选择收货地址 ></text></view>
		</hx-navbar>
		//背景占位
		<view
			style="height: 600rpx;background: linear-gradient(186.89deg, #DBF9F1 59.49%, rgba(219, 249, 241, 0) 93.7%);position: absolute;width: 100%;top: 0;">
		</view>
		<view class="container">
			<view class="head tab-right-active ">
				<!-- <view class="tab-box" v-if="tabIndex > 0">
					<view class="item left" :class="{ active: tabIndex == 1 }" @click="tabIndex = 1">
						<view class="tit-box"><text>配送</text></view>
					</view>
					<view class="item right" :class="{ active: tabIndex == 2 }" @click="tabIndex = 2">
						<view class="tit-box"><text>到店自取</text></view>
					</view>
				</view> -->
				<view class="topTip"><image src="/static/order/minilogo.png" mode="scaleToFill"></image><text>骑手/外卖已经休息了，暂时不能点单了</text></view>
				<view class="head-bottom" :class="{ selectOne: tabIndex == 1, selectTow: tabIndex == 2 }">
					<view class="tab" v-if="tabIndex == 2"></view>
					<view class="tab" v-else>
						<view class="t-top">
							<view class="t-top-box" @click="toAddress">
								<image src="/static/order/location.png" mode="widthFix"></image>
								<block v-if="!addressData"><text class="txt1">选择收货地址</text></block>
								<block v-else>
									<view class="wrapper">
										<view class="address-box">
											<text v-if="addressData.isDefault" class="tag">默认</text>
											<text
												class="address">{{ addressData.addressName }}{{ addressData.area }}</text>
										</view>
										<view class="u-box">
											<text class="name">{{ addressData.username }}</text>
											<text class="mobile">{{ addressData.mobile }}</text>
										</view>
									</view>
								</block>
								<u-icon name="arrow-right" size="14" color="#8799a3" />
							</view>
						</view>
						<view class="t-bb" style="background-color: rgba(242, 242, 242, 1);"></view>
						<view class="t-bottom">
							<view class="row1" @click="toSelectTime">
								<view class="left">
									<text>选择今日送达时间 ({{ timeGet }})</text>
								</view>
								<view class="right">
									<text>{{ timeGive }}</text>
									<i class="hxicon-right"></i>
								</view>
							</view>
							<!-- 						<view class="row2">
							<text>为减少接触，封闭管理时，请在地址中更新具体去餐点</text>
						</view> -->
						</view>
						<view class="t-bottom" v-if="sign==1&&kongYu">
							<view class="row1" @click="toSelectTimeTom">
								<view class="left">
									<text style="color: red;">预定明日送达时间 </text>
								</view>
								<view class="right" style="color: red;">
									<text>{{ timeGiveTom }}</text>
									<i class="hxicon-right"></i>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>

			<view class="b-r m-t">
				<view class="store">
					<view class="name ">
						<text style="font-weight: bold;font-size: 28rpx;">{{ storeData.data.name }}</text>
						<!-- 标志性位置 ，社区  如：白羊区店，玫瑰园小区 -->
						<text v-if="storeData.data.community">({{ storeData.community }})</text>
					</view>
					<view class="p-bb b-b"></view>
					<view class="goods-box">
						<block v-for="(goods, i) in storeData.shopping_cart" :key="i" v-if="storeData.shopping_cart">
							<view class="goods-item">
								<view class="left">
									<image :src="goods.img" mode="aspectFill"></image>
								</view>
								<view class="right">
									<view class="row1">
										<view class="tit">
											<text class="zk"
												v-if="goods.oldprice && Number(goods.price) < Number(goods.oldprice)">折</text>
											<text>{{ goods.name }}</text>
										</view>
										<view class="old-price" v-if="goods.oldprice">
											<text class="fh">￥</text>
											<text class="lt">{{ goods.oldprice }}</text>
										</view>
										<view class="price">
											<text class="fh">￥</text>
											<text>{{ goods.price }}</text>
										</view>
									</view>
									<view class="row2">
										<text>{{ goods.current_form ? goods.current_form.name : goods.descripe}}</text>
									</view>
									<view class="row3">
										x
										<text>{{ goods.number }}</text>
									</view>
								</view>
							</view>
						</block>
					</view>


					<view class="flex-rl peisong">
						<view class="right"><text>打包费</text></view>
						<view class="left">
							<!-- <text class="fh">￥</text><text>{{storeData.shipping_dees}}</text> -->
							<text class="fh">￥</text>
							<text>{{ packnum }}</text>
						</view>
					</view>
					<view class="flex-rl peisong">
						<view class="right">
							<text>配送费</text>
						</view>
						<view class="left">
							<!-- <text class="fh">￥</text><text>{{storeData.shipping_dees}}</text> -->
							<text class="fh">￥</text>
							<text v-if="delivery==3">{{shanglouPrice}}</text>
							<text v-else>{{shanglouPrice}}</text>
						</view>
					</view>
					<!-- 优惠 -->
					<view class="flex-rl peisong" @click="goCoupon">
						<view class="right"><text>优惠卡包</text>
							<image src="/static/order/card.png" style="width: 30rpx;height: 30rpx;margin-left: 8rpx;">
							</image>
						</view>
						<view class="left">
							<text style="color: #FF7658;">-￥{{totalYhPrice}}</text>
							<u-icon name="arrow-right" color="rgba(212, 212, 212, 1)"></u-icon>
						</view>

						<!-- <view v-for="(item,index) in couponList" :key="index">
							<view class="coupon-item">
								<view class="coupon-money">
									<text class="layof" style="color:red;font-size: 32rpx;">{{item.name}}</text>
									<text class="layof" style="color:red">￥{{item.amount}}</text>
									<view class="end_time">{{item.expirationTime}}前使用</view>
								</view>
								<view v-if="item.status == 3" class="get-btn" :style="couponColor">已选择
								</view>
								<view v-if="item.status == 0" @click="useCoupon(index)" class="get-btn"
									style="color: black;background-color: whitesmoke;border: 2rpx gainsboro solid;color: black;">
									选择使用
								</view>
								<view v-if="item.status == 1" class="get-btn"
									style="color:#fff; background-color:#ff9800;">已使用
								</view>
								<view v-if="item.status == 2" class="get-btn"
									style="color:#fff; background-color:burlywood;">已过期
								</view>
							</view>
						</view> -->
					</view>


					<view class="p-bb b-b"></view>
					<view class="flex-rl totalbox">
						<view class="left">
							<!-- <text>总费用</text>
						<i class="hxicon-question"></i> -->
						</view>
						<view class="right">
							<!-- 优惠部分 -->
							<view class="yh" v-if="couponList.length!=0||isHuodong||totalYhPrice">
								<text class="txt">已优惠</text>
								<text class="fh">￥</text>
								<text class="num">{{totalYhPrice}}</text>
							</view>
							<view class="total">
								<text class="txt">总计</text>
								<text class="fh">￥</text>
								<text class="num">{{ getPrice(totalPrice,totalYhPrice)  }}</text>
							</view>
						</view>
					</view>
				</view>
			</view>

			<view class=" other-box">
				<view class="flex-rl row">
					<view class="left"><text>餐具数量</text></view>
					<view class="right" @click="showNumberPopup">
						<text>{{ textNumber }}人</text>
						<i class="hxicon-right"></i>
					</view>
				</view>
			</view>
			<view class=" other-box">
				<view class="flex-rl row">
					<view class="left"><text>备注</text></view>
					<view class="right">
						<text v-if="remark" @click="showPopup">{{ remark }}</text>
						<text v-if="!remark" @click="showPopup">点击可填写备注</text>
						<i class="hxicon-right"></i>
					</view>
				</view>
			</view>
			<!-- //备注弹窗 -->
			<u-popup mode="center" v-model="showPop">
				<view class="pop_box">
					<textarea class="text-black" auto-focus="true" style="width:100%;height:320rpx;padding: 0 20rpx"
						:focus="isFocus" @input="messageInput" :value="remark" type="textarea" autosize border="false"
						:placeholder="placeText" />
					<view class="pop_btn_box margin-bottom-sm">
						<u-button :custom-style="customStyle" round @click="canclecomment" type="info">取消</u-button>
						<u-button :custom-style="customStyle" round @click="submitcomment" type="info">确定</u-button>
					</view>
				</view>
			</u-popup>

			<view class="body-end"></view>

			<view class="foot">
				<view class="left">
					<view class="price">
						<text class="fh">￥</text>
						<text class="txt">{{ getPrice(totalPrice,totalYhPrice) }}</text>
					</view>
					<view class="discount" v-if="totalYhPrice">
						<text>已优惠<text class="yh"><text
									style="font-size: 20rpx;">￥</text>{{ totalYhPrice }}</text></text>
					</view>
				</view>
				<!-- <view class="center">
				<text>找人付</text>
			</view> -->
				<view class="right" @click="submit"><text>立即支付</text></view>
			</view>
		</view>
		<!-- //时间选择框 -->
		<!-- 		<u-select v-model="showTime" mode="single-column" :list="selector" @confirm="timeConfirm"></u-select> -->
		<u-picker mode="selector" @confirm="timeConfirm" v-model="showTime" :default-selector="[0]" :range="selector">
		</u-picker>
		<u-picker mode="selector" @confirm="timeConfirmTom" v-model="showTimeTom" :default-selector="[0]"
			:range="selectorTom">
		</u-picker>
		<u-picker mode="selector" @confirm="NumberConfirm" v-model="showNumber" :default-selector="[0]"
			:range="selectorNumber"></u-picker>
		<!-- <u-picker mode="selector" @confirm="AddressConfirm" v-model="showAddress" :default-selector="[0]"
			:range="Addres"></u-picker> -->
	</view>
</template>

<script>
	import getDateTime from '../../common/getdataTime';
	//数据库引入
	const db = uniCloud.database();
	import youhuiquan from '@/components/youhuiquan-block/dingdan.vue'; // 优惠券组件
	//引入全局变量
	var app = getApp();
	export default {
		components: {
			youhuiquan
		},
		data() {
			return {
				showAddress:false,
				timeId: "",
				endtime: "",
				addressGetList: [],
				kongYu: false,
				couponId: -1,
				totalYhPrice: 0,
				isAllAngle: false,
				couponCount: 0,
				// 是否显示优惠券模态框
				isShowCouponModal: true,
				couponColor: "color:#ff9800; background-color:#fff",
				couponList: [],
				placeText: "填写备注时请勿添加空格字符和表情，系统将无法识别",
				ispass: "",
				packnum: 0, //打包费
				openid: '',
				textNumber: '1',
				timeGet: '',
				userinfo: {},
				//选择送达时间
				showTime: false,
				showTimeTom: false,
				showNumber: false,
				timeGive: '未选择(必选)',
				selectorNumber: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
				selector: ["11:30~11:50"],
				selectorTom: ["11:00~11:20", "11:20~11:40", "11:40~12:00", "12:00~12:20", "12:20~12:40", "12:40~13:00",
					"17:00~17:20", "17:20~17:40", "17:40~18:00", "18:00~18:20", "18:20~18:40", "18:40~17:00"
				],
				customStyle: {
					width: '150rpx',
					height: '50rpx',
					color: '#ffffff',
					background: 'linear-gradient(45deg, #0081ff, #1cbbb4)'
				},
				isgive: true,
				isFocus: true,
				showPop: false,
				scrollData: {},
				//购物车缓存 Storage 名称
				shoppingCartStorageName: 'shopping_cart',
				//门店信息
				storeData: {},
				//购物车
				shoppCart: [],
				//头部选项卡 参数为 0不显示选项卡,1,2
				tabIndex: 1,
				//收获地址
				addressData: null,
				//手机隐私
				ysStatus: true,
				//优惠券
				couponData: [],

				//结算价
				totalPrice: 0,
				//已优惠价
				//商品数量
				totalNumber: 0,
				delivery: 0,
				remark: '',
				place: "",
				timeGiveSelf: "",
				self: false,
				shanglouPrice: 1,
				isAgent: 0,
				schoolIndex: 0,
				code: "",
				timeGetTom: "",
				timeGiveTom: "",
				isYu: 0,
				jiaCount: 0, //计算有多少个加价的商品
				isHuodong: false, //是否参与满减活动
				huodongLou: [],
				huodongMoney: 0,
				huodongName: "",
				isNew: 0,
				newMoney: 0,
				maxcount: 0,
				bili: 0,
				peisong: 0,
				test: [{
					address: '中南大学升华公寓--16栋',
					area: ' 5层502',
					name: '张三',
					phone: '11122223333'
				}, {
					address: '中南大学升华公寓--16栋',
					area: ' 5层502',
					name: '张三',
					phone: '11122223333'
				}, {
					address: '中南大学升华公寓--16栋',
					area: ' 5层502',
					name: '张三',
					phone: '11122223333'
				}]
			};
		},
		props: {
			item: {
				type: Object
			},
			types: {
				type: String,
				default: ''
			},
			theme: {
				type: String,
				default: '#ff9000'
			},
			solid: {
				type: String,
				default: '#ffffff'
			},
			color: {
				type: String,
				default: '#ff9000'
			},
		},
		onLoad(option) {
			let that = this;
			//判断全局变量里面是否存在邀请码
			if (app.globalData.code == "无") {
				console.log("邀请码无")
			} else {
				console.log("邀请码有")
				this.isAgent = 1
				this.code = app.globalData.code
			}

			if (option.newMoney > 0) {
				//说明这个店铺是参加新客的
				//现在就需要判断这个人是否具有参加新客的资格，如果具备的话，那么isNew这个字段就true，然后那个已优惠改成新客减免，
				//如果他没有具备，那就else不去做任何操作
				//拿着店铺id和用户id去数据库里搜已支付的表数据，我们需要在新客下单了以后去进行填充，
				//需求后端：出一个接口，一个是查是否是新客，一个是添加新客记录
				//TODO：
				uni.request({
					url: "https://zback.shixiaozhu.work/ShixiaozhuTest/newCus/isNew?storeId=" + option.sid +
						"&openId=" + option.openid,
					success(res) {
						if (res.data.status == 200) {
							//说明是新客，修改优惠名称，修改优惠价格
							that.newMoney = option.newMoney
							that.totalYhPrice = option.newMoney
							that.isNew = 1
						}
					}
				})
			}
			db.collection('huodong').doc('6369d1f2642bcb0001920d72').get({
				getOne: true
			}).then(res => {
				// console.log("活动数据",res.result.data.data.iskai)
				that.kongYu = res.result.data.data.iskai
			})
			this.packnum = Number(parseFloat(option.packnum).toFixed(2));
			this.qishou = Number(parseFloat(option.qishou).toFixed(2));
			console.log('传过来的骑手费', this.qishou);
			this.openid = option.openid;
			this.place = option.place;
			this.self = option.self;
			this.sign = option.sign;
			this.schoolIndex = option.school;
			//TODO:先送达时间测试时间
			that.getGiveTime(this.sign,this.schoolIndex);
			let totalPrice = 0;
			let totalNumber = 0;
			let totalOldPrice = 0;
			if (option.sid) {
				that.delivery = option.delivery;
				if (that.delivery == 3) {
					that.shanglouPrice = 0.0
				} else {
					that.shanglouPrice = 1.0
				}
				that.ispass = option.ispass;
				that.sn = option.sn;
				that.shore_id = option.sid;
				that.storeImg = option.storeImg;
				that.shoppingCartStorageName = 'shopping_cart' + option.sid;
				let carts = uni.getStorageSync(that.shoppingCartStorageName) || [];
				console.log('订单页面获取到的购物车数据', carts);
				if (carts) {
					//根据缓存数据 获取购物车中属于本商店的商品
					for (let i in carts) {
						console.log('已经复值', option.sid);
						if (carts[i].data.store_id == option.sid) {
							that.shoppCart = carts[i].shopping_cart;
							that.storeData = carts[i];
							break;
						}
					}
				}
				let cj = 0;
				let op = 0;
				let p = 0;
				let num = 0;
				//计算总商品数量和总价
				for (var i in that.shoppCart) {
					that.shoppCart[i].price = Number(that.shoppCart[i].price).toFixed(2)
					p = Number(that.shoppCart[i].price);
					op = Number(that.shoppCart[i].oldprice);
					num = Number(that.shoppCart[i].number);
					console.log("该商品状态", that.shoppCart[i].isjia)
					if (that.shoppCart[i].isjia) {
						that.jiaCount = that.jiaCount + 0.3
					}
					totalNumber += num;
					totalPrice += p * num;
					if (op > p) {
						cj += (op - p) * num;
					}
				}
				that.totalPrice = totalPrice + this.packnum + this.shanglouPrice;
				// if (that.self) {
				// 	that.totalPrice = totalPrice + this.packnum;
				// } else {
				// 	that.totalPrice = totalPrice + this.packnum + 1;
				// }

				that.totalPrice = that.numFilter(that.totalPrice);
				//开始获取该店铺的抽佣比例
				db.collection('storeList').where({
					'data.store_id': that.shore_id
				}).get({
					getOne: true
				}).then((res) => {
					that.bili = Number(res.result.data.data.bili)
					that.peisong = Number(res.result.data.data.peisong)
				})

				// that.totalYhPrice = cj;
			}
			if (that.sign == 2 || that.sign == 3) {
				//检测是否是本部
				if (that.schoolIndex == 1) {
					uni.showToast({
						title: "本部尚未开启该模块点餐服务"
					})
				}
			} else {
				that.getCouponList(); //正餐才能用
			}
		},
		onPageScroll(e) {
			this.scrollData = e;
		},
		onShow() {
			// console.log(this.totalYhPrice,this.couponId)
			let that = this;
			that.huodongMoney = 0
			// that.totalYhPrice = 0
			that.isHuodong = false
			
			if (that.isNew) {
				that.totalYhPrice = that.newMoney
			}

			//备注赋值
			that.remark = getApp().globalData.remark;
			// y:年 m:月 d:日 h:时 i:分 s:秒 中间的分割符号可更改
			this.timeGet = getDateTime.dateTimeStr('m-d');
			//拿到满减活动后再去请求地址
			db.collection('huodong').doc("6367273b86569700014dcaf6").get().then(res => {
				// console.log("活动内容",res.result.data[0].data.iskai)
				if (res.result.data[0].data.iskai) {
					that.huodongLou = res.result.data[0].data.lou
					that.huodongName = res.result.data[0].data.name
					that.huodongMoney = res.result.data[0].data.money
				} else {
					//活动暂未开启
				}
				that.getAddressList();
			})
			//返回用户信息和id
			that.getCouponList();
		},
		methods: {
			selectAddress(index) {
				this.addressData = this.addressGetList[index]
				this.showAddress = false
			},
			//检查地址,重新获取时间
			checkAddress(addressName) {
				let that = this
				that.timeGive = "未选择(必选)"
				that.schoolIndex = addressName.school
				that.getGiveTime(this.sign, addressName.school);
				// if(addressName=='本部3舍'||addressName=='本部15舍'||addressName=='本部桃花公寓A'||addressName=='本部桃花公寓B'||addressName=='本部桃花公寓C'){
				// 	//是本部的单子
				// 	this.schoolIndex =1;
				// 	//TODO:先送达时间测试时间
				// 	that.getGiveTime(this.sign,this.schoolIndex);
				// }else{
				// 	this.schoolIndex =0;
				// 	//TODO:先送达时间测试时间
				// 	that.getGiveTime(this.sign,this.schoolIndex);
				// }
			},
			toSelectTimeTom() {
				let that = this
				uni.showModal({
					title: "您是否要预定明日订单？",
					success(res) {
						if (res.confirm) {
							that.isYu = 1
							that.showTimeTom = true;
						} else {
							return
						}
					}
				})
			},
			getPrice(totalPrice, totalYhPrice) {
				return (totalPrice - totalYhPrice).toFixed(2)
			},
			//优惠券
			getCouponList() {
				let that = this
				uni.showLoading({
					title: "正在获取。。。"
				})
				uni.request({
					url: "https://zback.shixiaozhu.work/ShixiaozhuTest/coupon/showMyCoupons?openid=" + that.openid,
					success(res) {
						if (res.data.status == 200) {
							that.couponList = res.data.data
							console.log("目前的couponList", that.couponList[0].amount)
							uni.hideLoading()
						}
					}
				})
			},
			useCoupon(index) {
				//已选择变成3
				for (var i = 0; i < this.couponList.length; i++) {
					if (index == i) {
						this.couponId = this.couponList[i].id
						console.log("优惠券id", this.couponId)
						this.totalYhPrice = this.couponList[i].amount
						// this.totalPrice = Number(this.totalPrice - this.totalYhPrice).toFixed(2)
						this.couponList[i].status = 3
					} else {
						if (this.couponList[i].status == 3) {
							this.couponList[i].status = 0
						}
					}
				}
			},
			getGiveTime(sign, school) {
				let that = this
				console.log("学校", school)
				if (sign == 1) {
					db.collection('givetime')
						.where({
							'data.school': Number(school)
						})
						.orderBy('data.id')
						.get()
						.then(res => {
							console.log('获取到的送达时间', res.result.data);
							let times = [];
							for (var i = 0; i < res.result.data.length; i++) {
								var item = {};
								if (res.result.data[i].data.iskai) {
									item.time = res.result.data[i].data.time
									item.timeId = res.result.data[i].id
									item.endtime = res.result.data[i].data.endtime
									item.maxcount = Number(res.result.data[i].data.count)
									times.push(item);
								}
							}
							if (times.length == 0) {
								that.isgive = false;
							}
							console.log(times)
							that.selector = times;
							uni.hideLoading();
						});
				} else if (sign == 2) {
					db.collection('nighttime')
						.where({
							'data.school': Number(school)
						})
						.get()
						.then(res => {
							console.log('获取到的送达时间', res.result.data);
							let times = [];
							for (var i = 0; i < res.result.data.length; i++) {
								var item = {};
								if (res.result.data[i].data.iskai) {
									item.time = res.result.data[i].data.time
									item.maxcount = Number(res.result.data[i].data.count)
									times.push(item);
								}
							}
							if (times.length == 0) {
								that.isgive = false;
							}
							that.selector = times;
							uni.hideLoading();
						});
				} else if (sign == 3) {
					db.collection('morningtime')
						.get()
						.then(res => {
							console.log('获取到的送达时间', res.result.data);
							let times = [];
							for (var i = 0; i < res.result.data.length; i++) {
								var item = {};
								if (res.result.data[i].data.iskai) {
									item.time = res.result.data[i].data.time
									item.maxcount = Number(res.result.data[i].data.count)
									times.push(item);
								}
							}
							if (times.length == 0) {
								that.isgive = false;
							}
							that.selector = times;
							uni.hideLoading();
						});
				} else {
					db.collection('deliverytime')
						.get()
						.then(res => {
							console.log('获取到的送达时间', res.result.data);
							let times = [];
							for (var i = 0; i < res.result.data.length; i++) {
								var item = {};
								if (res.result.data[i].data.iskai) {
									item.time = res.result.data[i].data.time
									item.maxcount = Number(res.result.data[i].data.count)
									times.push(item);
								}
							}
							if (times.length == 0) {
								that.isgive = false;
							}
							that.selector = times;
							uni.hideLoading();
						});
				}
			},
			formatDateTime(inputTime) {
				var date = new Date(inputTime);
				var y = date.getFullYear();
				var m = date.getMonth() + 1;
				m = m < 10 ? ('0' + m) : m;
				var d = date.getDate();
				d = d < 10 ? ('0' + d) : d;
				var h = date.getHours();
				h = h < 10 ? ('0' + h) : h;
				var minute = date.getMinutes();
				var second = date.getSeconds();
				minute = minute < 10 ? ('0' + minute) : minute;
				second = second < 10 ? ('0' + second) : second;
				return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
			},
			numFilter(value) {
				// 截取当前数据到小数点后两位
				let realVal = Number(parseFloat(value).toFixed(2));
				return realVal;
			},
			showNumberPopup() {
				this.showNumber = true;
			},
			timeConfirmTom(e) {
				console.log(e);
				this.isYu = 1
				e = Number(e)
				console.log("哈哈哈", e)
				this.timeGiveTom = this.selectorTom[e];
				// if (e == '0') {
				// 	this.timeGiveTom =this.selector[0];
				// } else if (e == '1') {
				// 	this.timeGiveTom = this.selector[1];
				// } else if (e == '2') {
				// 	this.timeGiveTom = this.selector[2];
				// } else if (e == '3') {
				// 	this.timeGiveTom = this.selector[3];
				// } else if (e == '4') {
				// 	this.timeGiveTom = this.selector[4];
				// } else if (e == '5') {
				// 	this.timeGiveTom = this.selector[5];
				// } else if (e == '6') {
				// 	this.timeGiveTom = this.selector[6];
				// }
				console.log("送达时间", this.timeGiveTom)
			},
			timeConfirm(e) {
				console.log(e);
				this.isYu = 0;
				this.timeGive = this.selector[Number(e)].time
				this.maxcount = this.selector[Number(e)].maxcount
				this.endtime = this.selector[Number(e)].endtime
				this.timeId = this.selector[Number(e)].timeId
				console.log("最大", this.maxcount)
				// if (e == '0') {
				// 	this.timeGive = this.selector[0];
				// } else if (e == '1') {
				// 	this.timeGive = this.selector[1];
				// } else if (e == '2') {
				// 	this.timeGive = this.selector[2];
				// } else if (e == '3') {
				// 	this.timeGive = this.selector[3];
				// } else if (e == '4') {
				// 	this.timeGive = this.selector[4];
				// } else if (e == '5') {
				// 	this.timeGive = this.selector[5];
				// } else if (e == '6') {
				// 	this.timeGive = this.selector[6];
				// }
				console.log("送达时间", this.timeGive)
			},
			NumberConfirm(e) {
				this.textNumber = this.selectorNumber[Number(e)];
			},
			toSelectTime() {
				this.showTime = true;
			},
			toAddress() {
				// uni.navigateTo({
				// 	url: '../address/address?openid=' + this.openid+"&school="+this.schoolIndex
				// });
				this.showAddress = true

			},
			closeAddress() {
				this.showAddress = false
			},
			//新增地址
			toAddressManagePage() {
				uni.navigateTo({
					url: '../address/addressManage/addressManage?openid=' + this.openid
				});
			},
			//修改地址
			toResetAddress(id) {
				console.log(id)
				uni.navigateTo({
					url: `../address/addressManage/addressManage?id=${id}&openid=` + this.openid+"&from=pre",
				})
			},
			//去优惠券页面
			goCoupon(){
				uni.navigateTo({
					url:'../me/coupon/coupon?from=pre'+'&openid='+this.openid+'&couponId='+this.couponId
				})
			},
			//请求地址列表
			getAddressList() {
				let that = this;
				uni.showLoading({
					title: "正在获取地址数据..."
				})
				if (app.globalData.shuaxinAddressID == '') {
					console.log("开始请求所有地址", "https://zback.shixiaozhu.work/ShixiaozhuTest/address/getAddressBySchool?openid=" +
						this
						.openid + "&school=" + Number(that.schoolIndex))
					//根据openid请求后端地址信息
					uni.request({
						url: "https://zback.shixiaozhu.work/ShixiaozhuTest/address/getAddressBySchool?openid=" + this
							.openid + "&school=" + Number(that.schoolIndex),
						success(res) {
							if (res.data.status == 200) {
								uni.hideLoading()
								that.addressData = res.data.data[0];
								that.addressGetList = res.data.data
								console.log("地址", res)
								that.hasAdress = true;
								//去对比看看是否参与满减活动
								for (var i = 0; i < that.huodongLou.length; i++) {
									if (that.huodongLou[i] == that.addressData.addressName) {
										that.totalYhPrice = that.huodongMoney
										that.isHuodong = true
										if (that.isNew) {
											// that.isNew = false
											// that.newMoney = 0
											that.totalYhPrice = Number(that.huodongMoney) + Number(that.newMoney)
										}

										//说明有条件参与满减活动,便宜5块，然后弹出提示
										uni.showModal({
											title: that.huodongName
										})
									}
								}
								console.log("校区", that.addressData.school)
								that.checkAddress(that.addressData)
							} else {
								uni.hideLoading()
							}
						}

					})
				} else {
					console.log("开始请求指定地址", app.globalData.shuaxinAddressID)
					//根据openid请求后端地址信息
					uni.request({
						url: "https://zback.shixiaozhu.work/ShixiaozhuTest/address/getAddressByid?addressId=" +
							app.globalData.shuaxinAddressID,
						success(res) {
							if (res.data.status == 200) {
								var list = []
								list.push(res.data.data)
								that.addressData = list[0];
								that.checkAddress(that.addressData)
								that.hasAdress = true;
								//去对比看看是否参与满减活动
								for (var i = 0; i < that.huodongLou.length; i++) {
									if (that.huodongLou[i] == that.addressData.addressName) {
										that.isHuodong = true
										that.totalYhPrice = that.huodongMoney
										if (that.isNew) {
											// that.isNew = false
											// that.newMoney = 0
											that.totalYhPrice = Number(that.huodongMoney) + Number(that.newMoney)
										}
										//说明有条件参与满减活动,便宜5块，然后弹出提示
										uni.showModal({
											title: that.huodongName
										})
									}
								}

								uni.hideLoading()
							}
						}
					})
				}
			},
			submitcomment() {
				//提交备注
				this.showPop = false;
			},
			canclecomment() {
				this.remark = '';
				this.showPop = false;
			},
			//备注内容输入
			messageInput(e) {
				console.log(e.detail.value);
				this.remark = e.detail.value;
			},
			//回复弹窗
			showPopup() {
				uni.navigateTo({
					url: 'remark/remark?' + "remark=" + this.remark
				})
			},
			privacyStatusChange(e) {
				this.ysStatus = e.target.value;
			},
			//提交订单
			submit() {
				let that = this;
				let goodsID = [];
				var issubmit = true;
				for (var i in that.shoppCart) {
					goodsID.push(that.shoppCart[i].id);
				}

				if (that.sign == 2 || that.sign == 3) {
					//检测是否是本部
					if (that.schoolIndex == 1) {
						uni.showToast({
							title: "本部尚未开启该模块点餐服务"
						})
						return
					}
				}

				if (this.isYu == 1) {
					this.isgive = true
				}


				//TODO：开始测试创建
				if (!this.isgive) {
					uni.showModal({
						title: '今天点单时间已经结束，感谢您的支持',
						success(res) {
							if (res.confirm) {
								return;
							}
						}
					});
				} else {
					if (!this.addressData) {
						uni.showModal({
							title: '请选择收货地址',
							success(res) {
								if (res.confirm) {
									return;
								}
							}
						});
					} else {
						if (that.isYu == 0) {
							//如果不是预定没选时间不能点
							if (that.timeGive == '未选择(必选)' || that.timeGive == undefined) {
								uni.showModal({
									title: '请选择送达时间',
									success(res) {
										if (res.confirm) {
											return;
										}
									}
								});
								return
							}
						} else {
							//如果不是预定没选时间不能点
							if (that.timeGiveTom == '' || that.timeGiveTom == undefined) {
								uni.showModal({
									title: '请选择预定明日送达时间',
									success(res) {
										if (res.confirm) {
											return;
										}
									}
								});
								return
							}
						}

						if (that.isYu == 1) {
							//是预定单，就修改时间状态
							that.timeGive = that.timeGiveTom
						}


						// TODO：开始启动对时间点自动控制
						var date = new Date();
						var hour = date.getHours();
						var fen = date.getMinutes();
						if (that.isYu == 0) {
							//TODO：开始进行自动时间点控制
							var endhour = that.endtime.split(':')[0]
							var endmin = that.endtime.split(':')[1]
							if (hour == Number(endhour) && fen > Number(endmin)) {
								console.log("时间点已关闭")
								uni.showModal({
									title: "非常抱歉，该时间点已关闭，请选择其他时间点",
									success(res) {
										return
									}
								})
								//将该时间点关闭
								db.collection('givetime')
									.doc(that.timeId)
									.update({
										data: {
											iskai: false
										}
									})
									.then((res) => {
										console.log("成功！", res)
										that.$refs.uToast.show({
											title: '成功操作！',
											type: 'success'
										});
									})
								return
							}

						}
						//开始计算抽佣
						var ktmoney = parseFloat((that.totalPrice - that.jiaCount - that
							.newMoney) * (100 - that.bili) / 100).toFixed(2) - that.peisong
						if (that.sign == 1) {
							//check目前的时间是否已经关闭
							db.collection('givetime').where({
								'data.time': that.timeGive,
								'data.school': Number(that.schoolIndex)
							}).get({
								getOne: true
							}).then((res) => {
								console.log("检查时间点是否关闭", res.result.data.data.iskai)
								//TODO:预定环境直接开
								// res.result.data.data.iskai = true
								if (that.isYu == 1) {
									res.result.data.data.iskai = true
								}
								if (res.result.data.data.iskai) {
									// 向后台发送 data 进行真实合计，生成订单，并返回订单信息
									let myDate = new Date().Format('yyyy-MM-dd hh:mm:ss');
									var myTime = new Date().Format('hh:mm:ss');
									var time = parseInt(myTime.split(':')[1]) + 5;
									var deloyetime = myDate.split(' ')[0] + ' ' + myTime.split(':')[0] + ':' +
										time +
										':' + myTime
										.split(':')[2];
									var timestamp = new Date().getTime();
									console.log("当前价格", that.totalPrice)
									console.log("提现状态", that.delivery)

									uni.showLoading({
										title: '正在生成订单'
									});

									//TODO：要对此处进行商品图片的地址获取
									let content = '';
									for (var i = 0; i < that.shoppCart.length; i++) {
										if (that.shoppCart[i].current_form == undefined) {
											content = content + that.shoppCart[i].name.replace(/\s+/g, "").replace(
													/\+/gi, "%2B") +
												' ' + that.shoppCart[i]
												.price + ' ' + that
												.shoppCart[i].number + ' ' + that.shoppCart[i].img + ';';
										} else {
											content =
												content +
												that.shoppCart[i].name.replace(/\s+/g, "").replace(/\+/gi, "%2B") +
												'(' +
												that.shoppCart[i].current_form.name.replace(/\s+/g, "").replace(
													/\+/gi,
													"%2B") +
												')' +
												' ' +
												that.shoppCart[i].current_form.price +
												' ' +
												that.shoppCart[i].number + ' ' +
												that.shoppCart[i].img +
												//这个商品的img内容是最后加的，同过空格对数据进行解析，在后端对数据实体进行构造然后插入数据表中
												';';
										}
										console.log("商品内容", content)
									}
									var otype = 1
									if (that.sign == 3) {
										otype = 3
									}
									if (that.sign == 4) {
										otype = 4
										//需要对可提现的价格
									}

									var isCoupon = 0
									if (that.couponId != -1) {
										isCoupon = 1
										//如果使用了优惠券，就不用新客
										that.isNew = 0
										that.newMoney = 0
									} else {
										isCoupon = 0
									}

									//暂时先将isCoupon 代表加价了多少
									// that.point = that.jiaCount

									var data1 = {
										oSchool: Number(that.schoolIndex),
										point: that.totalYhPrice,
										uopenid: that.openid,
										storeId: that.shore_id,
										name: that.addressData.username,
										mobile: that.addressData.mobile,
										addressname: that.addressData.addressName,
										area: that.addressData.area,
										palce: that.place,
										packNum: that.packnum,
										canshu: that.textNumber,
										remark: that.remark,
										money: that.totalPrice,
										ktMoney: Number(ktmoney),
										storeName: that.storeData.data.name,
										givetime: that.timeGive,
										ispass: that.ispass,
										sn: that.sn,
										storeImg: that.storeImg,
										oType: otype,
										cId: that.couponId,
										content: content,
										isCoupon: isCoupon,
										isAgent: that.isAgent,
										code: that.code,
										isYu: that.isYu,
										isNew: that.isNew,
										newMoney: that.newMoney,
										extra: that.jiaCount,
										maxcount: that.maxcount
									}
									if (that.timeGive == '未选择(必选)' || that.timeGive == '未选择（必选）') {
										uni.showModal({
											title: "未选择时间点无法下单",
											success(res) {
												if (res.confirm) {
													return
												}
											}
										})
										return
									}
									//TODO:创建订单开始测试
									uni.request({
										url: "https://zback.shixiaozhu.work/ShixiaozhuTest/order/creatOrder",
										method: "POST",
										header: {
											'content-type': 'application/x-www-form-urlencoded;charset:utf-8'
										},
										data: data1,
										success(res) {
											if (res.data.status == 200) {
												let tradeNo = res.data.data.orderId
												let expirationTime = res.data.data.expirationTime
												let money = that.getPrice(that.totalPrice, that
													.totalYhPrice)
												let oid = tradeNo.substring(tradeNo.length - 3)
												uni.hideLoading();
												//假设返回了订单信息，跳转至支付页面
												uni.redirectTo({
													url: '/pages/order/pay?id=' +
														tradeNo +
														'&openid=' + that.openid +
														'&money=' +
														money +
														"&expirationTime=" +
														expirationTime +
														"&store_name=" + that
														.storeData.data.name +
														"&store_id=" + that
														.storeData.data
														.store_id
												});

											} else {
												uni.hideLoading();
												if (res.data.status == 500) {
													uni.showModal({
														title: "下单异常",
														content: res.data.msg,
														success() {
															return
														}
													})
												} else {
													uni.showModal({
														title: "创建订单出现异常，请联系食小助wx：shixiaozhu",
														success() {
															return
														}
													})
												}
											}
										}
									})
								} else {
									uni.showModal({
										title: '该时间点已经关闭，请选择其他时间点',
										success(res) {
											if (res.confirm) {
												return;
											}
										}
									});
								}
							})
						} else if (that.sign == 2) {
							//check目前的时间是否已经关闭
							db.collection('nighttime').where({
								'data.time': that.timeGive
							}).get({
								getOne: true
							}).then((res) => {
								console.log("检查时间点是否关闭", res.result.data.data.iskai)
								if (res.result.data.data.iskai) {
									// 向后台发送 data 进行真实合计，生成订单，并返回订单信息
									let myDate = new Date().Format('yyyy-MM-dd hh:mm:ss');
									var myTime = new Date().Format('hh:mm:ss');
									var time = parseInt(myTime.split(':')[1]) + 5;
									var deloyetime = myDate.split(' ')[0] + ' ' + myTime.split(':')[0] + ':' +
										time +
										':' + myTime
										.split(':')[
											2];
									var timestamp = new Date().getTime();
									
									console.log("当前价格", that.totalPrice)
									console.log("提现状态", that.delivery)
									
									uni.showLoading({
										title: '正在生成订单'
									});

									//TODO：要对此处进行商品图片的地址获取
									let content = '';
									for (var i = 0; i < that.shoppCart.length; i++) {
										if (that.shoppCart[i].current_form == undefined) {
											content = content + that.shoppCart[i].name.replace(/\s+/g, "").replace(
													/\+/gi, "%2B") +
												' ' + that.shoppCart[i]
												.price + ' ' + that
												.shoppCart[i].number + ' ' + that.shoppCart[i].img + ';';
										} else {
											content =
												content +
												that.shoppCart[i].name.replace(/\s+/g, "").replace(/\+/gi, "%2B") +
												'(' +
												that.shoppCart[i].current_form.name.replace(/\s+/g, "").replace(
													/\+/gi,
													"%2B") +
												')' +
												' ' +
												that.shoppCart[i].current_form.price +
												' ' +
												that.shoppCart[i].number + ' ' +
												that.shoppCart[i].img +
												//这个商品的img内容是最后加的，同过空格对数据进行解析，在后端对数据实体进行构造然后插入数据表中
												';';
										}
										console.log("商品内容", content)
									}
									var otype = 1
									if (that.sign == 3) {
										otype = 3
									}
									if (that.sign == 4) {
										otype = 4
										//需要对可提现的价格
									}

									var isCoupon = 0
									if (that.couponId != -1) {
										isCoupon = 1
										//如果使用了优惠券，就不用新客
										that.isNew = 0
										that.newMoney = 0
									} else {
										isCoupon = 0
									}

									var data1 = {
										oSchool: Number(that.schoolIndex),
										point: that.totalYhPrice,
										uopenid: that.openid,
										storeId: that.shore_id,
										name: that.addressData.username,
										mobile: that.addressData.mobile,
										addressname: that.addressData.addressName,
										area: that.addressData.area,
										palce: that.place,
										packNum: that.packnum,
										canshu: that.textNumber,
										remark: that.remark,
										money: that.totalPrice,
										ktMoney: Number(ktmoney),
										storeName: that.storeData.data.name,
										givetime: that.timeGive,
										ispass: that.ispass,
										sn: that.sn,
										storeImg: that.storeImg,
										oType: otype,
										cId: that.couponId,
										content: content,
										isCoupon: isCoupon,
										isAgent: that.isAgent,
										code: that.code,
										isYu: that.isYu,
										isNew: that.isNew,
										newMoney: that.newMoney,
										extra: that.jiaCount,
										maxcount: that.maxcount
									}
									//TODO:创建订单开始测试
									uni.request({
										url: "https://zback.shixiaozhu.work/ShixiaozhuTest/order/creatOrder",
										method: "POST",
										header: {
											'content-type': 'application/x-www-form-urlencoded;charset:utf-8'
										},
										data: data1,
										success(res) {
											if (res.data.status == 200) {
												let tradeNo = res.data.data.orderId
												let expirationTime = res.data.data.expirationTime
												let money = that.getPrice(that.totalPrice, that
													.totalYhPrice)
												let oid = tradeNo.substring(tradeNo.length - 3)
												uni.hideLoading();
												//假设返回了订单信息，跳转至支付页面
												uni.redirectTo({
													url: '/pages/order/pay?id=' +
														tradeNo +
														'&openid=' + that.openid +
														'&money=' +
														money +
														"&expirationTime=" +
														expirationTime +
														"&store_name=" + that
														.storeData.data.name +
														"&store_id=" + that
														.storeData.data
														.store_id
												});
											} else {
												uni.hideLoading();
												uni.showModal({
													title: "创建订单出现异常，请联系食小助wx：shixiaozhu",
													success() {
														return
													}
												})
											}
										}
									})
								} else {
									uni.showModal({
										title: '该时间点已经关闭，请选择其他时间点',
										success(res) {
											if (res.confirm) {
												return;
											}
										}
									});
								}
							})
						} else {
							//check目前的时间是否已经关闭
							db.collection('morningtime').where({
								'data.time': that.timeGive
							}).get({
								getOne: true
							}).then((res) => {
								console.log("检查时间点是否关闭", res.result.data.data.iskai)
								if (res.result.data.data.iskai) {
									// 向后台发送 data 进行真实合计，生成订单，并返回订单信息
									let myDate = new Date().Format('yyyy-MM-dd hh:mm:ss');
									var myTime = new Date().Format('hh:mm:ss');
									var time = parseInt(myTime.split(':')[1]) + 5;
									var deloyetime = myDate.split(' ')[0] + ' ' + myTime.split(':')[0] + ':' +
										time +
										':' + myTime
										.split(':')[
											2];
									var timestamp = new Date().getTime();
									
									console.log("当前价格", that.totalPrice)
									console.log("提现状态", that.delivery)
									
									uni.showLoading({
										title: '正在生成订单'
									});

									//TODO：要对此处进行商品图片的地址获取
									let content = '';
									for (var i = 0; i < that.shoppCart.length; i++) {
										if (that.shoppCart[i].current_form == undefined) {
											content = content + that.shoppCart[i].name.replace(/\s+/g, "").replace(
													/\+/gi, "%2B") +
												' ' + that.shoppCart[i]
												.price + ' ' + that
												.shoppCart[i].number + ' ' + that.shoppCart[i].img + ';';
										} else {
											content =
												content +
												that.shoppCart[i].name.replace(/\s+/g, "").replace(/\+/gi, "%2B") +
												'(' +
												that.shoppCart[i].current_form.name.replace(/\s+/g, "").replace(
													/\+/gi,
													"%2B") +
												')' +
												' ' +
												that.shoppCart[i].current_form.price +
												' ' +
												that.shoppCart[i].number + ' ' +
												that.shoppCart[i].img +
												//这个商品的img内容是最后加的，同过空格对数据进行解析，在后端对数据实体进行构造然后插入数据表中
												';';
										}
										console.log("商品内容", content)
									}
									var otype = 1
									if (that.sign == 3) {
										otype = 3
									}
									if (that.sign == 4) {
										otype = 4
										//需要对可提现的价格
									}

									var isCoupon = 0
									if (that.couponId != -1) {
										isCoupon = 1
										//如果使用了优惠券，就不用新客
										that.isNew = 0
										that.newMoney = 0
									} else {
										isCoupon = 0
									}
									var data1 = {
										oSchool: Number(that.schoolIndex),
										point: that.totalYhPrice,
										uopenid: that.openid,
										storeId: that.shore_id,
										name: that.addressData.username,
										mobile: that.addressData.mobile,
										addressname: that.addressData.addressName,
										area: that.addressData.area,
										palce: that.place,
										packNum: that.packnum,
										canshu: that.textNumber,
										remark: that.remark,
										money: that.totalPrice,
										ktMoney: Number(ktmoney),
										storeName: that.storeData.data.name,
										givetime: that.timeGive,
										ispass: that.ispass,
										sn: that.sn,
										storeImg: that.storeImg,
										oType: otype,
										cId: that.couponId,
										content: content,
										isCoupon: isCoupon,
										isAgent: that.isAgent,
										code: that.code,
										isYu: that.isYu,
										isNew: that.isNew,
										newMoney: that.newMoney,
										extra: that.jiaCount,
										maxcount: that.maxcount
									}
									//TODO:创建订单开始测试
									uni.request({
										url: "https://zback.shixiaozhu.work/ShixiaozhuTest/order/creatOrder",
										method: "POST",
										header: {
											'content-type': 'application/x-www-form-urlencoded;charset:utf-8'
										},
										data: data1,
										success(res) {
											if (res.data.status == 200) {
												let tradeNo = res.data.data.orderId
												let expirationTime = res.data.data.expirationTime
												let money = that.getPrice(that.totalPrice, that
													.totalYhPrice)
												let oid = tradeNo.substring(tradeNo.length - 3)
												uni.hideLoading();
												//假设返回了订单信息，跳转至支付页面
												uni.redirectTo({
													url: '/pages/order/pay?id=' +
														tradeNo +
														'&openid=' + that.openid +
														'&money=' +
														money +
														"&expirationTime=" +
														expirationTime +
														"&store_name=" + that
														.storeData.data.name +
														"&store_id=" + that
														.storeData.data
														.store_id
												});
											} else {
												uni.hideLoading();
												if (res.data.status == 500) {
													uni.showModal({
														title: "下单异常",
														content: res.data.msg,
														success() {
															return
														}
													})
												} else {
													uni.showModal({
														title: "创建订单出现异常，请联系食小助wx：shixiaozhu",
														success() {
															return
														}
													})
												}
											}
										}
									})
								} else {
									uni.showModal({
										title: '该时间点已经关闭，请选择其他时间点',
										success(res) {
											if (res.confirm) {
												return;
											}
										}
									});
								}
							})
						}
					}
				}
			}
		}
	};
</script>

<style lang="scss">
	page {
		background-color: rgba(243, 244, 246, 1);
	}

	.couponModal {
		display: flex;
		flex-direction: column;
		position: fixed;
		z-index: 700;
		top: 0;
		left: 0;
		width: 100vw;
		height: 100vh;
		background: rgba(0, 0, 0, 0.3);

		.top {
			flex: 1;
		}

		.bottom {
			height: 1100rpx;
			background: #f5f5f5;
			border-radius: 20rpx 20rpx 0 0;
			position: relative;

			.icon-block {
				display: inline-flex;
				align-items: center;
				position: absolute;
				right: 1em;
				top: 1em;
				font-size: 26rpx;
				// color: $red-color;
				color: #bbbdc0;
				border: 2rpx solid #bbbdc0;
				border-radius: 100rpx;
				padding-left: 0.5em;
				padding-right: 0.5em;
			}

			.title-h4 {
				text-align: left;
				padding-left: 24rpx;

				color: $grey1-color;
				line-height: 110rpx;
				font-size: 30rpx;
			}

			.content {
				padding: 0 34rpx;

				.title-h5 {
					color: $grey2-color;
					line-height: 55rpx;
					font-size: 30rpx;
				}

				.card-wrap {
					height: 880rpx;

					.card-block {
						height: 100%;
						overflow-x: hidden;
						// @include hide-scrollbar;
						padding-bottom: 10rpx;

						.item {
							margin-bottom: 20rpx;

							position: relative;
							width: 682rpx;
							height: 261rpx;
							border-radius: 20rpx;
							background: #ffffff;
							overflow: hidden;
							box-shadow: 0 3rpx 3rpx #f0f1f3;

							&::before,
							&::after {
								content: '';
								display: block;
								position: absolute;
								top: 50%;
								width: 40rpx;
								height: 40rpx;
								background: $bg-grey-color;
								border-radius: 50%;
							}

							&::before {
								left: 0;
								transform: translate3d(-50%, -50%, 0);
							}

							&::after {
								right: 0;
								transform: translate3d(50%, -50%, 0);
							}

							.isSelectBlock {
								position: absolute;
								top: 0;
								right: 0;
								width: 54rpx;
								height: 54rpx;
								border-radius: 0 10rpx 0 0;
								overflow: hidden;

								.gb-sanjiao {
									border-top: 28rpx solid #fb4e44;
									border-right: 28rpx solid #fb4e44;
									border-bottom: 28rpx solid transparent;
									border-left: 28rpx solid transparent;
								}

								.checkmarkempty {
									font-size: 0;
									position: absolute;
									top: 0;
									right: 10%;
								}
							}

							.goods-top-block {
								display: flex;
								margin-top: 20rpx;
								margin-left: 20rpx;

								.goods-image-block {
									margin-left: 10rpx;
									width: 130rpx;
									height: 130rpx;

									image {
										width: 100%;
										height: 100%;
									}
								}

								.goods-description {
									display: flex;
									width: 510rpx;
									flex-direction: column;
									border-bottom: 2rpx dashed #efefef;
									margin-left: 1em;
									margin-right: 1em;

									.goods-name {
										font-size: 26rpx;
										line-height: 55rpx;
										font-weight: 600;
										color: $grey1-color;
										max-width: 15em;
										// @include text-ellipsis;
									}

									.price-wrap {
										display: flex;
										justify-content: space-between;
										// @include shop-price-block-lr;

										.use-btn {
											// @include flex-center;
											width: 140rpx;
											height: 56rpx;
											font-size: 23rpx;
											color: #ffffff;
											border-radius: 10000rpx;
										}
									}
								}
							}

							.goods-bottom-block {
								margin-top: 20rpx;
								margin-left: 20rpx;
								font-size: 20rpx;
								color: $grey2-color;

								.card-name {
									line-height: 45rpx;
								}

								.time-block {}
							}
						}
					}
				}
			}

			.nav-bar-block {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 0 24rpx;
				height: 110rpx;
				background: #ffffff;

				.bar-text {
					font-size: 30rpx;
					color: $grey1-color;
				}

				.bar-btn {
					width: 200rpx;
					height: 80rpx;
					line-height: 80rpx;
					text-align: center;
					color: #ffffff;
					font-size: 35rpx;
					border-radius: 10rpx;
				}
			}
		}
	}

	.topTip{
		// width: 100%;
		height: 50rpx;
		background: linear-gradient(-6deg,rgba(255, 116, 72, 0.07) 19.66%, rgba(255, 153, 0, 0.32) 89.81%);
		border-radius: 10rpx;
		margin: 20rpx;
		// text-align: center;
		// line-height: 50rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		text{
			font-size: 20rpx;
			color: rgba(255, 109, 77, 1);
			font-weight: 700;
		}
		image{
			width: 48rpx;
			height: 48rpx;
			margin-right: 6rpx;
			margin-top: 6rpx;
		}
	}

	.pop_box {
		width: 500rpx;
		height: auto;
	}

	.pop_btn_box {
		display: flex;
		justify-content: space-around;
	}

	.text-input {
		width: 100%;
		min-height: 250rpx;
		max-height: 600rpx;
		font-weight: 500;
		background-color: #999999;
	}

	.b-r {
		border-radius: 12rpx;
	}

	.m-t {
		margin-top: 12rpx;
	}

	.p-bb {
		margin: 32rpx 0;
		height: 2rpx;
		//background:  #E4E7ED;
	}

	.flex-rl {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
	}

	.container {
		width: 94%;
		// margin-left: 24rpx;
		// margin-right: 24rpx;
		margin: 0 3%;
		// background-color: #ffffff;
		position: absolute;
		top: 140rpx;
		// border-radius:16rpx;

	}

	.mask {
		width: 100vh;
		height: 100%;
		position: fixed;
		// background: rgba(0, 0, 0, 0.5);
		z-index: 999;

		.bg {
			height: 100%;
			width: 100%;
			position: absolute;
			background: rgba(0, 0, 0, 0.5);
		}

		.address {
			width: 100%;
			position: fixed;
			bottom: 0;
			background-color: #fff;
			border-radius: 28rpx 28rpx 0 0;
			background: linear-gradient(209.15deg, rgba(219, 249, 241, 0.2) 10.81%, rgba(219, 249, 241, 0) 40.2%), #FFFFFF;

			.close {
				position: absolute;
				top: 54rpx;
				right: 64rpx;
			}

			.top {
				width: 100%;
				text-align: center;
				font-size: 32rpx;
				font-weight: 700;
				height: 140rpx;
				line-height: 140rpx;
			}

			.btn {
				border-top: 2rpx solid #E7E7E7;
				width: 100%;
				padding: 30rpx 24rpx;

				.addbtn {

					background: linear-gradient(104.97deg, #FC9A8D 27.17%, #FDDBB4 107.39%);
					box-shadow: 0px 8rpx 8rpx rgba(0, 0, 0, 0.15);
					border-radius: 14rpx;
					height: 100rpx;
					font-size: 30rpx;
					font-weight: 700;
					color: #fff;
					text-align: center;
					line-height: 100rpx;
					// margin: 30rpx 24rpx;
				}
			}

			.center {
				padding: 0 44rpx;

				.addressLi {
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: space-around;

					.user {
						font-size: 30rpx;
						font-weight: 700;
						flex: 10;
						padding: 30rpx 34rpx;
					}

					.radio {
						width: 40rpx;
						// flex: 1;
					}

					.edit {
						width: 32rpx;
						// flex: 1;
						// height: 32rpx;
					}

					.info {
						display: flex;
						flex-direction: row;
						font-size: 24rpx;
						color: rgba(89, 89, 89, 1);
						font-weight: 400;
						align-items: center;
						padding-top: 16rpx;
					}

				}

				.line {
					height: 1rpx;
					width: 100%;
					background-color: rgba(173, 173, 173, 0.4);
				}

				.line:last-of-type {
					height: 0;
				}
			}
		}
	}

	.p12 {
		padding: 14rpx 22rpx;
	}

	.t-top-box {
		display: flex;
	}

	.head {
		// width: 100%;
		background: #fff;
		box-shadow: 0px 8rpx 12rpx rgba(0, 0, 0, 0.05);
		border-radius: 16rpx;
		overflow: hidden;

		.tab-box {
			position: relative;
			height: 80rpx;
			margin: 0 24rpx;

			.item {
				position: absolute;
				top: 0;
				bottom: 0;
				height: 80rpx;
				text-align: center;
				font-size: 28rpx;

				width: 50%;

				.tit-box {
					position: relative;
					height: 72rpx;
					line-height: 72rpx;
					border-top-left-radius: 12rpx;
					border-top-right-radius: 12rpx;
					background-color: rgba(#ffffff, 0.6);
					width: 100%;
				}
			}

			.item:first-child {
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: flex-end;
				left: 0;
			}

			.item:last-child {
				display: flex;
				flex-direction: row;
				justify-content: flex-end;
				align-items: flex-end;
				right: 0;
			}

			.active {
				height: 80rpx;
				width: 51%;
				font-weight: bold;

				.tit-box {
					height: 80rpx;
					line-height: 80rpx;
					background-color: rgba(#ffffff, 1);
				}
			}

			.left .tit-box {
				margin-left: 24rpx;
				margin-right: -24rpx;
				padding-right: 24rpx;
			}

			.right .tit-box {
				margin-right: 24rpx;
				margin-left: -24rpx;
				padding-left: 24rpx;
			}

			.left.active .tit-box {
				margin: 0;
			}

			.right.active .tit-box {
				margin: 0;
			}

			.left.active .tit-box:after {
				content: '';
				position: absolute;
				right: -24rpx;
				bottom: 0;
				border-top: 24rpx solid transparent;
				border-right: 24rpx solid transparent;
				border-bottom: 72rpx solid #ffffff;
			}

			.right.active .tit-box:after {
				content: '';
				position: absolute;
				left: -24rpx;
				bottom: 0;
				border-top: 24rpx solid transparent;
				border-left: 24rpx solid transparent;
				border-bottom: 72rpx solid #ffffff;
			}
		}

		.wrapper {
			display: flex;
			flex-direction: column;
			flex: 1;

		}

		.address-box {
			display: flex;
			align-items: center;
			margin-bottom: 12rpx;

			.tag {
				font-size: 24upx;
				color: $base-color;
				margin-right: 10upx;
				background: #fffafb;
				border: 2rpx solid #ffc107;
				border-radius: 4upx;
				padding: 4upx 10upx;
				line-height: 1;
			}

			.address {
				font-size: 32rpx;
				font-weight: 900;
				color: #000;
			}
		}

		.u-box {
			font-size: 24rpx;
			color: rgba(89, 89, 89, 1);
			margin-top: 12rpx;

			.name {
				margin-right: 30upx;
			}
		}

		.head-bottom {
			overflow: hidden;
			background: #ffffff;
			border-top-left-radius: 12rpx;
			border-top-right-radius: 12rpx;
			border-bottom-left-radius: 12rpx;
			border-bottom-right-radius: 12rpx;

			.tab {
				.t-top {
					&-box {
						position: relative;
						margin: 0;
						padding: 24rpx;

						image {
							position: absolute;
							bottom: 0;
							right: 24rpx;
							width: 254rpx;
						}

						.txt1 {
							font-size: 36rpx;
							color: #888;
						}

						.icon1 {
							margin-left: 16rpx;
							color: #bbb;
						}
					}

					&-box:active {
						background-color: #f5f5f5;
					}
				}

				.t-bb {
					margin: 0 24rpx;
					height: 1rpx;
					background-color: #e4e7ed;
				}

				.t-bottom {
					padding: 14rpx 24rpx 24rpx 24rpx;

					.row1 {
						display: flex;
						flex-direction: row;
						justify-content: space-between;

						//padding: 24rpx 0 0;
						.left {
							font-size: 24rpx;
							// font-weight: bold;
						}

						.right {
							font-size: 20rpx;
							color: rgba(186, 186, 186, 1);

							i {
								// margin-left: 16rpx;
								color: #bbb;
							}
						}
					}

					.row2 {
						margin-top: 12rpx;
						font-size: 24rpx;
						color: #ff9800;
					}
				}
			}
		}

		.head-bottom.selectOne {
			border-top-left-radius: 0;
			border-top-right-radius: px;
		}

		.head-bottom.selectTow {
			border-top-left-radius: 12rpx;
			border-top-right-radius: 0;
		}
	}

	.store {
		display: flex;
		flex-direction: column;
		background-color: #fff;
		border-radius: 16rpx;
		padding: 14rpx 22rpx;
		box-shadow: 0px 8rpx 12rpx rgba(0, 0, 0, 0.05);

		.name {
			// padding: 8rpx 0 0rpx;
			font-size: 28rpx;
			font-weight: 700rpx;
			color: rgba(57, 57, 57, 1);
			margin-top: 10rpx;
		}

		.goods-box {
			.goods-item {
				margin-top: 40rpx;
				display: flex;
				flex-direction: row;

				.left {
					width: 76rpx;
					height: 76rpx;

					image {
						border-radius: 8rpx;
						overflow: hidden;
						width: 100%;
						height: 100%;
						background-color: #f1f1f1;
					}
				}

				.right {
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					flex: 1;
					padding-left: 28rpx;

					.row1 {
						display: flex;
						flex-direction: row;
						justify-content: space-between;

						.tit {
							font-size: 24rpx;
							color: rgba(56, 54, 54, 1);
							font-weight: bold;
							flex: 1;
							flex-wrap: wrap;

							.zk {
								padding: 2rpx 6rpx;
								font-size: 20rpx;
								margin-right: 16rpx;
								border-radius: 8rpx;
								background-color: #f9221d;
								color: #ffffff;
							}
						}

						.old-price {
							padding-left: 28rpx;
							padding-top: 6rpx;
							font-size: 20rpx;
							color: rgba(132, 130, 130, 1);
							// font-weight: bold;
							margin-right: -6rpx;

							.lt {
								text-decoration: line-through;
							}

							.fh {
								font-size: 20rpx;
							}
						}

						.price {
							font-size: 28rpx;
							padding-left: 24rpx;
							color: rgba(56, 54, 54, 1);
							font-weight: 700;

							.fh {
								font-size: 28rpx;
							}
						}
					}

					.row2 {
						font-size: 18rpx;
						color: rgba(57, 57, 57, 1);
					}

					.row3 {
						font-size: 20rpx;
						color: rgba(89, 89, 89, 1);
					}
				}
			}

			.goods-item:first-child {
				margin: 0;
			}
		}

		.peisong {
			margin-top: 32rpx;

			.right {
				font-size: 20rpx;
				// font-weight: bold;
				color: rgba(57, 57, 57, 1);
				display: flex;
				align-items: center;
			}

			.left {
				font-size: 24rpx;
				font-weight: 700;
				color: #393939;

				.fh {
					font-size: 20rpx;
				}
			}
		}

		.zhekou-box {
			.zhekou {
				display: flex;
				flex-direction: column;
				margin-top: 24rpx;

				.row1 {
					align-items: center;

					.left {
						display: flex;
						flex-direction: row;
						align-items: center;
						height: 40rpx;
						line-height: 40rpx;

						i {
							font-size: 32rpx;
							color: #ff5722;
						}

						.tit {
							font-weight: bold;
							margin-left: 12rpx;
							font-size: 28rpx;
							color: #333;
						}
					}

					.right {
						.tag1 {
							font-weight: bold;
							font-size: 28rpx;
							color: #ff5722;
						}
					}
				}

				.row2 {
					height: 40rpx;
					line-height: 40rpx;
					font-size: 24rpx;
					color: #888;
				}
			}

			.zhekou:first-child {
				margin: 0;
			}
		}

		.totalbox {
			align-items: flex-end;

			.left {
				display: flex;
				flex-direction: row;
				align-items: center;
				font-size: 28rpx;
				color: #888;

				[class*='hxicon-'] {
					color: #aaa;
					margin-left: 8rpx;
					font-size: 32rpx;
				}
			}

			.right {
				display: flex;
				flex-direction: row;
				align-items: flex-end;

				.yh {
					color: rgba(255, 118, 88, 1);

					.txt {
						color: rgba(157, 157, 157, 1);
						font-size: 28rpx;
					}

					.fh {
						font-weight: bold;
						margin-left: 6rpx;
						font-size: 24rpx;
					}

					.num {
						font-weight: 900;
						font-size: 36rpx;
					}
				}

				.total {
					margin-left: 24rpx;
					color: #333;

					.txt {
						font-size: 28rpx;
						color: rgba(157, 157, 157, 1);
					}

					.fh {
						margin-left: 6rpx;
						font-size: 24rpx;
						font-weight: bold;
					}

					.num {
						font-weight: 900;
						font-size: 36rpx;
					}
				}
			}
		}
	}

	.coupon-item {
		width: 100%;
		height: auto;
		display: table;
		border-radius: 10upx;
		padding: 0 20upx;
		margin-top: 22upx;
		border: 2rpx solid #eeeeee;
		position: relative;

		.coupon-money {
			width: 465upx;
			height: auto;
			display: table;
			float: left;
			padding: 26upx 0;
			border-style: none dotted none none;
			border-color: #eeeeee;

			.nick {
				width: 100%;
				height: 50upx;
				line-height: 30upx;
			}

			.tit {
				width: 100%;
				height: 50upx;
				line-height: 50upx;
			}

			.demand {
				width: 100%;
				height: 30upx;
				line-height: 30upx;
			}

			.layof {
				width: 100%;
				height: 48upx;
				line-height: 30upx;
				font-size: 44upx;
				color: #ff9000;
				font-weight: bold;
			}

			.end_time {
				width: 100%;
				height: 30upx;
				line-height: 30upx;
			}
		}

		.get-btn {
			width: 146upx;
			height: 52upx;
			line-height: 50upx;
			position: absolute;
			top: 50%;
			right: 26upx;
			margin-top: -26upx;
			text-align: center;
			border-radius: 60upx;
			color: #ff9000;
			border: 2rpx solid #ff9000;
			float: right;
		}
	}

	.coupon-item:after {
		width: 40upx;
		height: 20upx;
		position: absolute;
		left: 460upx;
		top: -2rpx;
		border-radius: 0 0 40upx 40upx;
		content: "";
		display: block;
		background: #fff;
		border: 2rpx solid #eeeeee;
		border-top: 0rpx;
	}

	.coupon-item:before {
		width: 40upx;
		height: 20upx;
		position: absolute;
		left: 460upx;
		bottom: -2rpx;
		border-radius: 40upx 40upx 0 0;
		content: "";
		display: block;
		background: #fff;
		border: 2rpx solid #eeeeee;
		border-bottom: 0rpx;
	}

	.privacy {
		display: flex;
		flex-direction: column;

		.row1 {
			align-items: flex-end;

			.left {
				display: flex;
				flex-direction: row;
				align-items: center;

				.icon1 {
					color: #444;
					font-size: 48rpx;
				}

				.icon2 {
					color: #aaa;
					margin-left: 12rpx;
					font-size: 32rpx;
				}

				.txt {
					color: #333;
					margin-left: 12rpx;
					font-weight: bold;
					font-size: 28rpx;
				}
			}

			.right {}
		}

		.row2 {
			margin-top: 8rpx;
			color: #888;
			font-size: 24rpx;
		}

		.row3 {
			margin-top: 16rpx;
			font-size: 24rpx;
			color: #ff9800;
		}
	}

	.other-box {
		display: flex;
		flex-direction: column;
		background-color: #fff;
		padding: 26rpx 28rpx 26rpx 20rpx;
		box-shadow: 0px 8rpx 12rpx rgba(0, 0, 0, 0.05);
		border-radius: 16rpx;
		margin-top: 20rpx;

		.row {
			align-items: center;

			.left {
				font-size: 28rpx;
				color: #333;
				font-weight: bold;
				flex: 1;
			}

			.right {
				display: flex;
				flex-direction: column;
				justify-content: flex-end;
				align-items: center;
				flex-wrap: wrap;
				width: 60%;
				font-size: 28rpx;
				display: flex;
				flex-direction: row;
				color: #aaa;

				[class*='hxicon-'] {
					position: relative;
					top: 2rpx;
					font-size: 28rpx;
				}
			}
		}
	}

	.body-end {
		height: 200rpx;
	}

	.foot {
		z-index: 11;
		position: fixed;
		display: flex;
		flex-direction: row;
		border-radius: 14rpx;
		overflow: hidden;
		bottom: 24rpx;
		left: 24rpx;
		right: 24rpx;
		height: 100rpx;

		.left {
			width: 70%;
			// padding: 0 24rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: left;
			background-color: #FFF3ED;
			flex: 1;

			.price {
				display: flex;
				flex-direction: row;
				align-items: baseline;
				color: rgba(57, 57, 57, 1);
				height: 50rpx;
				line-height: 50rpx;
				margin-left: 20rpx;

				.fh {
					font-weight: bold;
					font-size: 20rpx;
				}

				.txt {
					font-size: 44rpx;
					font-weight: bold;
				}
			}

			.discount {
				margin-left: 28rpx;
				margin-top: 4rpx;
				font-size: 20rpx;
				color: #595959;

				.yh {
					font-weight: 700;
					font-size: 32rpx;
					color: rgba(255, 118, 88, 1);
				}
			}
		}

		.center {
			display: flex;
			align-items: center;
			background-color: #444;
			color: #ffc107;
			font-weight: bold;
			font-size: 32rpx;
			padding-left: 30rpx;
			padding-right: 30rpx;
			transition: all 0.3s;
		}

		.center:active {
			background-color: #666;
		}

		.right {
			width: 30%;
			display: flex;
			align-items: center;
			color: #FFF;
			font-weight: 700;
			font-size: 30rpx;
			justify-content: center;
			// padding-left: 30rpx;
			// padding-right: 30rpx;
			transition: all 0.3s;
			background: linear-gradient(111.77deg, #FC9A8D 56.92%, #FDDBB4 109.99%);
		}

		.right:active {
			background: linear-gradient(45deg, #e0ce31, #e4ad06);
		}
	}
</style>
